package exception;
/**
 * 演示异常的抛出
 */
public class Person {
    private int age;

    public int getAge(){
        return age;
    }

    public void setAge(int age)throws Exception{
        if(age<0 || age>120){
            throw new Exception("年龄不符合要求");
        }
        this.age = age;
    }

}
